<?php echo $this->headScript()->appendFile( '/public/js/framework/ajaxfileupload.js' );?>  
<?php echo $this->headScript()->appendFile('/public/js/products/aodai.js'); ?>

 <script type="text/javascript">
       function ajaxFileUpload()
       {
//          $("#loading")
//          .ajaxStart(function(){
//             $(this).show();
//          })
//          .ajaxComplete(function(){
//             $(this).hide();
//          });

          $.ajaxFileUpload
          (
             {
                url:'/public/common/upload',
                secureuri:false,
                fileElementId:'picture',
                dataType: 'json',
                success: function (data, status)
                {				var path = "<?php echo MYPATH ?>"; 
                   if(typeof(data.error) != 'undefined')
                   {
                      if(data.error != '')
                      {
                         alert(data.error);
                      }else
                      {
                         alert(data.msg);
                         $("#img_up").html("<img width='200' src='" + path + "/" + data.file +"'>");						 $("#hdf_image").val(path + "/" + data.file);
                      }
                   }
                },
                error: function (data, status, e)
                {
                   alert(e);
                }
             }
          )
          
          return false;

       }
       </script>   
<form action=<?php echo MYPATH ."/products/create"?> method="post">
<table>
	<tr>
		<td>Ten sanh pham</td>
		<td> <input type="text" id="txt_name" name="txt_name"></td>		
	</tr>
	<tr>
		<td>Mo ta</td>
		<td> <textarea  id="txt_description" name="txt_description" rows="3"></textarea></td>		
	</tr>
	<tr>
		<td>Hinh anh </td>
		<td>
		
		    <input type="file" name="picture" id="picture"  />
		    <input type="button" name="add_image" id="add_image" value="add" onclick="return ajaxFileUpload();" />
		
		</td>
	</tr>
	<tr>
		<td colspan="2" align="right">
			<div id="img_up"></div>			<input type="hidden" name="hdf_image" id="hdf_image">
		</td>
	</tr>
	<tr>
		<td colspan="2" align="right">
			<input type="submit" name="create_aodai" value="Them">
		</td>
	</tr>
	
</table></form>
<br>
<div >
link huong dan upload anh bang ajax tren zend <br>
http://www.zend.vn/forum/viewtopic.php?f=5&t=1249
</div>

